
from sketchc import *

window = Window((1000, 800))


wheel6 = Wheelp(V2(-2, -2), 0.5, color=(255, 0, 0))
@wheel6.set_callback
def _(delta):
    x, y =delta
    box1.t.walk(rot = vrot(U3(0, 0, 1), x))
    box1.t.walk(rot = vrot(U3(-1, 0, 0), y))
wheel6 >> window

wheel4 = Wheelh(V2(-2, -1.3), color=(255, 0, 0))
@wheel4.set_callback
def _(delta):
    box1.t.walk(rot=vrot(U3(0, 1, 0), delta))
wheel4 >> window

box1 = make_block(U3(1, 1, 1))
box1.u(window.ctx)  # .u()是更新vao用的，vao又绑定于context
box1.color = V3(0.9, 0.9, 0.9)
box1 >> window

camera = Camera(U3(0, -5, 1))
camera >> window        # 识别为camera则自动作为主camera

clock = pygame.time.Clock()
while True:
    for e in pygame.event.get():
        if e.type == pygame.QUIT:
            exit()
        window.dispatch(e)
    window.render()   # screen 操作需要写在window的槽里
    pygame.display.flip()
    clock.tick(60)

